{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "月工资收入：\n",
      "0    6000\n",
      "1    7000\n",
      "2    6500\n",
      "3    7200\n",
      "4    6800\n",
      "Name: 月工资收入, dtype: int64\n",
      "\n",
      "修改后的数据集：\n",
      "  员工姓名 性别  年龄  月工资收入\n",
      "0   张三  男  25   6000\n",
      "2   王五  女  28   6500\n",
      "3   赵六  男  32   7200\n",
      "4   钱七  女  27   6800\n",
      "5  赵一平  男  34   7000\n",
      "\n",
      "月工资收入大于6000元的员工数据：\n",
      "  员工姓名 性别  年龄  月工资收入\n",
      "2   王五  女  28   6500\n",
      "3   赵六  男  32   7200\n",
      "4   钱七  女  27   6800\n",
      "5  赵一平  男  34   7000\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "\n",
    "# 创建数据集\n",
    "data = {\n",
    "    '员工姓名': ['张三', '李明', '王五', '赵六', '钱七'],\n",
    "    '性别': ['男', '男', '女', '男', '女'],\n",
    "    '年龄': [25, 30, 28, 32, 27],\n",
    "    '月工资收入': [6000, 7000, 6500, 7200, 6800]\n",
    "}\n",
    "\n",
    "df = pd.DataFrame(data)\n",
    "\n",
    "# 选择月工资收入这列数据\n",
    "salary_column = df['月工资收入']\n",
    "print(\"月工资收入：\")\n",
    "print(salary_column)\n",
    "\n",
    "# 增加一位员工收入信息\n",
    "new_data = {'员工姓名': '赵一平', '性别': '男', '年龄': 34, '月工资收入': 7000}\n",
    "df = pd.concat([df, pd.DataFrame([new_data])], ignore_index=True)\n",
    "\n",
    "# 修改员工姓名为“李明”的月工资收入为8000\n",
    "df.loc[df['员工姓名'] == '李明', '月工资收入'] = 8000\n",
    "\n",
    "# 删除第2位员工的数据\n",
    "df = df.drop(1)\n",
    "\n",
    "# 筛选出月工资收入大于6000元的员工数据\n",
    "high_salary_employees = df[df['月工资收入'] > 6000]\n",
    "\n",
    "print(\"\\n修改后的数据集：\")\n",
    "print(df)\n",
    "print(\"\\n月工资收入大于6000元的员工数据：\")\n",
    "print(high_salary_employees)\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
